package com.example.forum.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OpenApiConfig {

    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("论坛系统API")
                        .version("1.0")
                        .description("论坛系统前后端分离API测试")
                        .contact(new Contact().name("Tech").url("https://bilibili.com").email("113java.com")));
    }

    @Bean
    public GroupedOpenApi forumApi() {
        return GroupedOpenApi.builder()
                .group("forum-api")
                .packagesToScan("com.example.forum.controller") // 指定需要扫描的包
                .build();
    }
}